from tkinter import *
root = Tk()

def printName():
    print('Hello! My name is Vic.')
def func(event):
    print('Event occured')

button_1 = Button(root, text = 'Print My Name', command = printName) #通过command把函数和控件绑定
button_2 = Button(root, text = 'Is event occured?')
button_2.bind('<Button-1>',func) #通过bind把控件行为和函数绑定
button_1.pack()
button_2.pack()


root.mainloop()